#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <stdio.h>
struct  People_info
{
    char name[20];
    char brith[20];
    char sexual[20];
    char major1[30];
    char speciality[30];
};
struct  User_info
{
    char user_password[40];
    char ID[40];
};
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void Add_user();
    void Add_administrator();
    struct People_info All_people[1000];

    struct User_info All_user[9];
    struct User_info All_administrator[9];
    FILE* people_msg_file;
    FILE* user_msg_file;
    FILE* administrator_msg_file;
    int people_number, people_page_now,people_page_num;
    int user_number;
    int administrator_number;
//    int prople_msg_page_flag = 1;
//    Line_Edit my_Line(ui);
public slots:
    void affirm_user_msg();
    void affirm_administrator_msg();

    void on_click_manager_people_msg();
    void show_people_msg_table();
    void clean_people__msg_table();
    void people_masg_end_page();
    void people_masg_first_page();
    void people_masg_next_page();
    void people_masg_last_page();
    void people_masg_page_jump();
    void set_current_peopleMsg_page();
    void delet_oneperson();
    void add_oneperson();
    void save_edited_people_masg();
    void back_to_main_menu();
    void on_click_edit_user_and_administrator_msg();
    void on_click_view_people_msg();
    void normal_user_back_to_main_menu();
    void add_user();
    void add_administrator();
    void delet_user();
private:
    Ui::MainWindow *ui;
    void hide_other();
    void open_file();
    void read_people_msg_file();
    void read_user_msg_file();
    void read_administrator_msg_file();

    void show_users_table();
    void clean_users_table();
    void write_user_msg_to_file();
    void write_administrator__msg_to_file();
    int char_to_int(const char* data);
    void write_people_msg_to_file();

};


#endif // MAINWINDOW_H
